package leetcode.math;

/**
 * https://leetcode-cn.com/problems/power-of-three/
 *
 * @author mazouri
 * @create 2021-09-25 10:39
 */
public class _326_isPowerOfThree {
    public boolean isPowerOfThree(int n) {
        if (n <= 0) return false;

        while (n != 1) {
            if (n % 3 == 0) n = n / 3;
            else return false;
        }
        return true;
    }

    public static void main(String[] args) {
        System.out.println(new _326_isPowerOfThree().isPowerOfThree(0));
    }
}
